home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 89
/
089.d81
/
text to basic.s
< prev
next >
Wrap
Text File
|
2022-08-26
|
3KB
|
252 lines
open =$ffc0
readst =$ffb7
stop =$ffe1
setlfs =$ffba
setnam =$ffbd
load =$ffd5
getin =$ffe4
clrchn =$ffcc
close =$ffc3 ;a
chrin =$ffcf
chkout =$ffc9 ;x
chkin =$ffc6 ;x
plot =$fff0
chrout =$ffd2
color'pointer =243
screen'line'pointer =209
print'number =$bdcd ;x,a
clear'line =59903
background =53281
border =53280
unlisten =$ffae
clall =$ffe7
.org $c000
.mem
;sysaddr,source drive,dest drive,textfile,newfile,start line,inc
jmp start
jmp instructions
start jsr get'number
lda $14
cmp #8
bcs +
lda #8
+ sta source
jsr get'number
lda $14
cmp #8
bcs +
lda #8
+ sta destination
lda #0
sta endflag
jsr get'string
jsr setnam
lda #2
ldx source
ldy #8
jsr setlfs
jsr open
ldx #2
jsr chkin
jsr getin
jsr getin
get'dest jsr get'string
jsr setnam
lda #3
ldx destination
ldy #1
jsr setlfs
jsr open
ldx #3
jsr chkout
lda 43
sta location
jsr chrout
lda 44
sta location+1
jsr chrout
get'starting jsr get'number
lda $14
sta starting'line
lda $15
sta starting'line+1
get'increment jsr get'number
lda $14
sta increment
lda $15
sta increment+1
here'we'go lda 197
cmp #62
bne +
jmp end'of'file
+ lda #6
sta count
lda location
sta line
lda location+1
sta line+1
lda starting'line
sta line+2
lda starting'line+1
sta line+3
lda #$83; token for DATA
sta line+4
lda #$22; quote
sta line+5
lda #6
clc
adc location
sta location
bcc +
inc location+1
+ ldx #2
jsr chkin
ldy #6
- jsr getin
beq end'of'line
cmp #34
bne +
lda "'"
+ sta temp
jsr readst
and #64
beq +
dec endflag
lda temp
cmp #13
beq eof'jump
cmp #0
beq eof'jump
cmp #10
beq eof'jump
sta line,y
iny
eof'jump jmp end'of'line
+ lda temp
cmp #13
beq end'of'line
cmp #10
beq end'of'line
sta line,y
inc location
bne +
inc location+1
+ iny
cpy #254
bcc -
end'of'line lda #$22
sta line,y
iny
lda #0
sta line,y
lda #2
clc
adc location
sta location
bcc +
inc location+1
+ iny
sty count
lda location
sta line
lda location+1
sta line+1
write ldx #3
jsr chkout
ldy #0
- lda line,y
jsr chrout
iny
cpy count
bne -
lda increment
clc
adc starting'line
sta starting'line
lda increment+1
adc starting'line+1
sta starting'line+1
bit endflag
bvs end'of'file
jmp here'we'go
end'of'file lda #0
jsr chrout
jsr chrout
jsr clrchn
lda #3
jsr close
lda #2
jmp close
;***** get string from BASIC ****
get'string jsr $aefd
jsr $ad9e
jsr $b6a3
ldx $22
ldy $23
rts
;**** get number from BASIC ****
get'number jsr $aefd
jsr $ad8a
jsr $b7f7
lda $14 ; got low byte
rts
instructions ldy #0
- lda text,y
beq +
jsr chrout
iny
bne -
+ rts
starting'line .word 0
increment .word 0
location .word 0
line .buf 254
count .byt 1
temp .byt 0
endflag .byt 0
text .asc "sys addr,source drive,destination drive,sourcefile$,destfile$,starting line,increment":.byt 0
source .byt 0
destination .byt 0